{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "#Table of Contents\n", "* [From Bouncing Ball to Angry Birds](#From-Bouncing-Ball-to-Angry-Birds)\n", "\t* [Stationary Object](#Stationary-Object)\n", "\t* [Brownian Motion](#Brownian-Motion)\n", "\t* [Velocity](#Velocity)\n", "\t\t* [Bouncing off the walls](#Bouncing-off-the-walls)\n", "\t\t* [Gravity](#Gravity)\n", "\t\t* [Dampening](#Dampening)\n", "\t* [Interactivity](#Interactivity)\n", "\t* [Angry Birds](#Angry-Birds)\n", "\t* [Conclusion](#Conclusion)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# From Bouncing Ball to Angry Birds" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This notebook explores the idea that objects on our sketch appear to move in various ways:\n", "\n", "* Falls\n", "* Projectiles\n", "* Bounces\n", "\n", "This is a magic trick... nothing really \"moves\"... it is just the canvas redrawn in an appropriate way that gives the illusion of movement." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Stationary Object" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We will use our drawObject code from last week. First, let's create a sketch where an object is drawn in position (x,y), where x and y are global variables. This allows setup() to initialize them, and draw() to use them." ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "\n", "